import count from '@dfeidao/atom-nodejs/db/count';
import query from '@dfeidao/atom-nodejs/db/query';
import { IncomingHttpHeaders } from 'http';
import { productid, systemid } from '../../atom/config';

interface Message {
	pn: number;
}


export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const p = query(action_id, session_id, systemid);
	p.prepare('department_staff', ['staff_no', 'staff_name', 'deptname'], { productid }, 5, message.pn, [], []);
	const [res] = await p.exec();
	const t = count(action_id, session_id, systemid);
	t.prepare('department_staff', { productid });
	const [con] = await t.exec();
	return { res, con };
}
